<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/icons-extra.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">	
			<a class="mui-icon mui-icon-back mui-action-back mui-pull-left"></a>
			<h1 class="mui-title ">Gallery</h1>
			<a class="mui-icon-extra mui-icon-extra-topic mui-pull-right" style="margin-top: 10px;"
				 onclick="openWindow('docGallery','../doc/gallery.html?v=20190621')"></a>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded">
				<div class="mui-row">
					Gallery模块管理系统相册，支持从相册中选择图片或视频文件、保存图片或视频文件到相册等功能。通过plus.gallery获取相册管理对象。
				</div>
				<br />
				<div class="mui-button-row">
					<button type="button" class="mui-btn mui-btn-success mui-btn-block" onclick="galleryImg()">选择单张图片</button>
					<button type="button" class="mui-btn mui-btn-primary mui-btn-block" onclick="galleryImgs()">选择多张图片</button>
				</div>
				<br />
				<div class="mui-row" id="divInfo" style="word-wrap:break-word">
					
				</div>
			</div>
		</div>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/app.js" ></script>
		<script type="text/javascript">
			mui.init();
			function outSet(message){
				document.getElementById("divInfo").innerText = message;
			}
			
			function outLine(message){
				var text = document.getElementById("divInfo").innerText;
				document.getElementById("divInfo").innerText = text + "\n" + message;
			}
			
			// 从相册中选择图片 
			function galleryImg() {
				// 从相册中选择图片
				outSet("从相册中选择图片:");
			    plus.gallery.pick( function(path){
			    	outLine(path);
			    }, function ( e ) {
			    	outLine( "取消选择图片" );
			    }, {filter:"image"} );
			}
			// 从相册中选择多张图片 
			function galleryImgs(){
				// 从相册中选择图片
				outSet("从相册中选择多张图片:");
			    plus.gallery.pick( function(e){
			    	for(var i in e.files){
				    	outLine(e.files[i]);
			    	}
			    }, function ( e ) {
			    	outLine( "取消选择图片" );
			    },{filter:"image",multiple:true});
			}
		</script>
	</body>

</html>